package com.neuedu.shop.entity;

import com.baomidou.mybatisplus.enums.IdType;

import java.sql.Timestamp;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotations.Version;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author X.Y鑫
 * @since 2021-04-12
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_admin")
public class Admin extends Model<Admin> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 管理员名
     */
    private String adminName;
    /**
     * 管理员密码（需要MD5加密）
     */
    private String adminPassword;
    /**
     * 创建时间
     */
    private Timestamp adminCreateTime;
    /**
     * 更新时间
     */
    private Timestamp adminUpdateTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public Admin(String adminName, String adminPassword) {
        this.adminName = adminName;
        this.adminPassword = adminPassword;
        this.adminCreateTime = new Timestamp(new Date().getTime());
        this.adminUpdateTime = new Timestamp(new Date().getTime());
    }
}
